﻿using HamcoWcs.Models.Devices;
using System.Collections.Generic;

namespace HamcoWcs.Models.Monitors
{
    public class MonitorData
    {
        //地址D5001：报警代码：1000 地面柜烟感报警
        //报警代码：1001地面柜温度异常
        public int DeviceErrorCount { get; set; } 

        public int MainTaskTimeOutCount { get; set; }
        public string CJSTW100CONTROLSTATE { get; set; } // CJSTW100控制状态

        public string CJSTW200CONTROLSTATE { get; set; } // CJSTW200控制状态

        public string CJSTW100STATE { get; set; }        // CJSTW100是否繁忙

        public string CJSTW200STATE { get; set; }        // CJSTW200是否繁忙

        public int MesControlState { get; set; } = 0;    // 0:MES离线， 1:MES在线

        public int WcsState { get; set; } = 0;           // 0:WCS离线， 1:WCS在线


        public MonitorGlobalConfig GlobalConfig { get; set; } = new MonitorGlobalConfig();

        public List<MonitorConData> MonitorConDatas { get; set; } = new List<MonitorConData>();

        public List<MonitorSrmData> MonitorSrmDatas { get; set; } = new List<MonitorSrmData>();


        public List<MonitorOtherData> MonitorOtherDatas { get; set; } = new List<MonitorOtherData>();


        public List<UIRaster> Rasters { get; set; } = new List<UIRaster>();


        public List<CabinetPara> CabinetParas { get; set; } = new List<CabinetPara>
        {
            new CabinetPara(1162,"MCC01数据"),
            new CabinetPara(1198,"MCC02数据"),
            new CabinetPara(1234,"MCC03数据"),
        };


        public List<BCRMonitor> BCRMonitors { get; set; } = new List<BCRMonitor>()
        {
            new BCRMonitor("BCR2",6,1,"CJMCV300-LEFT-BCR"),
            new BCRMonitor("BCR3",6,2,"CJMCV300-RIGHT-BCR"),
            new BCRMonitor("BCR7",6,6,"CJMCV700-LEFT-BCR"),
            new BCRMonitor("BCR8",6,7,"CJMCV700-RIGHT-BCR"),
            new BCRMonitor("BCR10",7,1,"CJMIFB00-LEFT-BCR"),
            new BCRMonitor("BCR11",7,2,"CJMIFC00-LEFT-BCR"),
            new BCRMonitor("BCR12",7,3,"CJRCV100-RIGHT-BCR"),
            new BCRMonitor("BCR13",7,4,"CJRCV200-RIGHT-BCR"),
            new BCRMonitor("BCR14",7,5,"CJRCV300-RIGHT-BCR"),
            new BCRMonitor("BCR15",7,6,"CJRCV400-RIGHT-BCR"),
        };

        //public List<MotorMileage> MotorMileages { get; set; }

        public List<ThresholdMonitor> ThresholdMonitors { get; set; } = new List<ThresholdMonitor>()
        {
            new ThresholdMonitor("搬送超时报警时间",10,"s","min",60),
        };


        public List<int> PpkStatus { get; set; } = new List<int>
        {
            3,3,3,3,3,
            3,3,3,3,3,
        };


        [System.Text.Json.Serialization.JsonIgnore]
        [Newtonsoft.Json.JsonIgnore]
        public List<ErrorBitInfo> ErrorBits { get; set; } = new List<ErrorBitInfo>()
        {
            #region [拉绳开关]

            new ErrorBitInfo("CJRGV200C1-ROPE","CJRGV200-C1拉绳开关触发",100,0),
            new ErrorBitInfo("CJRGV100C1-ROPE","CJRGV100-C1拉绳开关触发",100,1),
            new ErrorBitInfo("CJRGV100C2-ROPE","CJRGV100-C2拉绳开关触发",100,2),
            new ErrorBitInfo("CJRGV100C2-ROPE2","CJRGV100-C2维修区拉绳开关触发",100,3),

            #endregion

            #region [急停按钮]

            new ErrorBitInfo("MCC01-EMO","MCC01EMO急停按钮触发",581,0),
            new ErrorBitInfo("MCC01-EMS","MCC01EMS急停按钮触发",581,1),
            new ErrorBitInfo("CJRCV100-OP-EMO","D1301操作盒EMO急停按钮被触发",581,2),
            new ErrorBitInfo("CJRCV200-OP-EMO","D1302操作盒EMO急停按钮被触发",581,3),
            new ErrorBitInfo("CJRCV100-HMI-EMO","HMI01急停按钮触发",581,4),
            new ErrorBitInfo("CJRCV300-OP-EMO","D1303操作盒EMO急停按钮被触发",581,5),
            new ErrorBitInfo("CJRCV400-OP-EMO","D1304操作盒EMO急停按钮被触发",581,6),
            new ErrorBitInfo("CJRCV300-HMI-EMO","HMI02急停按钮触发",581,7),
            new ErrorBitInfo("CJRGV200-HMI-EMO","HMI03急停按钮触发",580,0),
            new ErrorBitInfo("CJVCV700-HMI-EMO","HMI04急停按钮触发",580,1),
            new ErrorBitInfo("CJVCV800-HMI-EMO","HMI05急停按钮触发",580,2),
            new ErrorBitInfo("CJVCV400-HMI-EMO","HMI11急停按钮触发",580,3),
            new ErrorBitInfo("CJMIFB00L1-OP-EMO","D1306操作盒EMO急停按钮被触发",580,4),
            new ErrorBitInfo("CJMIFB00L2-OP-EMO","D2302操作盒EMO急停按钮被触发",580,5),
            new ErrorBitInfo("CJMIFC00L1-OP-EMO","D1305操作盒EMO急停按钮被触发",580,6),
            new ErrorBitInfo("CJMIFC00L2-OP-EMO","D2301操作盒EMO急停按钮被触发",580,7),
            new ErrorBitInfo("MCC02-EMO","MCC02EMO急停按钮触发",583,0),
            new ErrorBitInfo("MCC02-EMS","MCC02EMS急停按钮触发",583,1),
            new ErrorBitInfo("CJMIF100-OP-EMO","D2101操作盒EMO急停按钮被触发",583,2),
            new ErrorBitInfo("CJVCV200-HMI-EMO","HMI06EMO急停按钮被触发",583,3),
            new ErrorBitInfo("CJMIF200-OP-EMO","D2102操作盒EMO急停按钮被触发",583,4),
            new ErrorBitInfo("CJMIF300-OP-EMO","D2201操作盒EMO急停按钮被触发",583,5),
            new ErrorBitInfo("CJMIF400-OP-EMO","D2103操作盒EMO急停按钮被触发",583,6),
            new ErrorBitInfo("CJMCV400-HMI-EMO","HMI07急停按钮触发",583,7),
            new ErrorBitInfo("CJMCV500-OP-EMO","D2104操作盒EMO急停按钮被触发",582,0),
            new ErrorBitInfo("CJMCV500-HMI-EMO","HMI08急停按钮触发",582,1),
            new ErrorBitInfo("CJMIF600-OP-EMO","D2105操作盒EMO急停按钮被触发",582,2),
            new ErrorBitInfo("CJMCV600-HMI-EMO","HMI09急停按钮触发",582,3),
            new ErrorBitInfo("CJMIF700-OP-EMO","D2202操作盒EMO急停按钮被触发",582,4),
            new ErrorBitInfo("CJMIF800-HMI-EMO","HMI10急停按钮触发",582,5),
            new ErrorBitInfo("CJMIF800-OP-EMO","D2106操作盒EMO急停按钮被触发",582,6),
            new ErrorBitInfo("CJMIF900-OP-EMO","D2107操作盒EMO急停按钮被触发",582,7),
 
            //add porjcet
            //new ErrorBitInfo("emo33","MCC03EMO急停按钮被触发",584,0),
            //new ErrorBitInfo("emo34","MCC03EMS急停按钮被触发",584,1),
            //new ErrorBitInfo("emo35","D2108操作盒EMO急停按钮被触发",584,2),
            //new ErrorBitInfo("emo36","EMO21急停按钮被触发",584,3),
            new ErrorBitInfo("MCC03-EMO","MCC03EMO急停按钮被触发",585,0),
            new ErrorBitInfo("MCC03-EMS","MCC03EMS急停按钮被触发",585,1),
            new ErrorBitInfo("CJMIFA00-OP-EMO","D2108操作盒EMO急停按钮被触发",585,2),
            new ErrorBitInfo("CJMCVA00-NET-EMO","EMO21急停按钮被触发",585,3),

            #endregion

            #region [产线异常]

            new ErrorBitInfo("PPKRASTER01","PPKLightCurtain01触发",591,0),
            new ErrorBitInfo("PPKRASTER02","PPKLightCurtain02触发",591,1),
            new ErrorBitInfo("PPKRASTER03","PPKLightCurtain03触发",591,2),
            new ErrorBitInfo("PPKRASTER04","PPKLightCurtain04触发",591,3),
            new ErrorBitInfo("PPKRASTER05","PPKLightCurtain05触发",591,4),
            new ErrorBitInfo("PPKRASTER06","PPKLightCurtain06触发",591,5),
            new ErrorBitInfo("PPKRASTER07","PPKLightCurtain07触发",591,6),
            new ErrorBitInfo("PPKRASTER08","PPKLightCurtain08触发",591,7),
            new ErrorBitInfo("PPKRASTER09","PPKLightCurtain09触发",592,0),
            new ErrorBitInfo("PPKRASTER10","PPKLightCurtain10触发",592,1),

            new ErrorBitInfo("PPKEMO01","PPKEMO01触发",593,0),
            new ErrorBitInfo("PPKEMO02","PPKEMO02触发",593,1),
            new ErrorBitInfo("PPKEMO03","PPKEMO03触发",593,2),
            new ErrorBitInfo("PPKEMO04","PPKEMO04触发",593,3),
            new ErrorBitInfo("PPKEMO05","PPKEMO05触发",593,4),
            new ErrorBitInfo("PPKEMO06","PPKEMO06触发",593,5),
            new ErrorBitInfo("PPKEMO07","PPKEMO07触发",593,6),
            new ErrorBitInfo("PPKEMO08","PPKEMO08触发",593,7),
            new ErrorBitInfo("PPKEMO09","PPKEMO09触发",594,0),
            new ErrorBitInfo("PPKEMO10","PPKEMO10触发",594,1),


            #endregion

            #region [设备连接异常]

            new ErrorBitInfo("CN01","MCCO1-IO连接异常",571,0),
            new ErrorBitInfo("CN02","MCCO2-IO连接异常",571,1),
            new ErrorBitInfo("CN03","FCCO1-IO连接异常",571,2),
            new ErrorBitInfo("CN04","FCC03-IO连接异常",571,3),
            new ErrorBitInfo("CN05","FCC04-IO连接异常",571,4),
            new ErrorBitInfo("CN06","FCC05-IO连接异常",571,5),
            new ErrorBitInfo("CN07","FCC06-IO连接异常",571,6),
            new ErrorBitInfo("CN08","FCC07-IO连接异常",571,7),
            new ErrorBitInfo("CN09","ECCO8-IO连接异常",570,0),
            new ErrorBitInfo("CN10","FCC13-IO连接异常",570,1),
            new ErrorBitInfo("CN11","FCCO9-IO连接异常",570,2),
            new ErrorBitInfo("CN12","FCC14-IO连接异常",570,3),
            new ErrorBitInfo("CN13","FCC10-IO连接异常",570,4),
            new ErrorBitInfo("CN14","FCC15-IO连接异常",570,5),
            new ErrorBitInfo("CN15","RGVO1连接异常",570,6),
            new ErrorBitInfo("CN16","RGVO3连接异常",570,7),
            new ErrorBitInfo("CN17","RGVO2连接异常",573,0),
            new ErrorBitInfo("CN18","FCC16-IO连接异常",573,1),
            new ErrorBitInfo("CN19","FCC17-IO连接异常",573,2),
            new ErrorBitInfo("CN20","BCR-P1003连接异常",573,3),
            new ErrorBitInfo("CN21","BCR-P1009连接异常",573,4),
            new ErrorBitInfo("CN22","BCR-P0037连接异常",573,5),
            new ErrorBitInfo("CN23","BCR-P0038连接异常",573,6),
            new ErrorBitInfo("CN24","BCR-P1006连接异常",573,7),
            new ErrorBitInfo("CN25","BCR-P1025连接异常",572,0),
            new ErrorBitInfo("CN26","BCR-P1020连接异常",572,1),
            new ErrorBitInfo("CN27","FCC12-IO连接异常",572,2),
            new ErrorBitInfo("CN28","FCC11-IO连接异常",572,3),
            new ErrorBitInfo("CN29","BCR-P1032连接异常",572,4),
            new ErrorBitInfo("CN30","BCR-P1028连接异常",572,5),
            new ErrorBitInfo("CN31","BCR-P1038连接异常",572,6),
            new ErrorBitInfo("CN32","FCC02-IO连接异常",572,7),
            new ErrorBitInfo("CN33","BCR-P1035连接异常",575,0),
            new ErrorBitInfo("CN34","P0037-LIFT连接异常",575,1),
            new ErrorBitInfo("CN35","P0038-LIFT连接异常",575,2),
            new ErrorBitInfo("CN36","BCR1连接异常",575,3),
            new ErrorBitInfo("CN37","BCR2连接异常",575,4),
            new ErrorBitInfo("CN38","BCR3连接异常",575,5),
            new ErrorBitInfo("CN39","BCR4连接异常",575,6),
            new ErrorBitInfo("CN40","BCR5连接异常",575,7),
            new ErrorBitInfo("CN41","BCR6连接异常",574,0),
            new ErrorBitInfo("CN42","BCR7连接异常",574,1),
            new ErrorBitInfo("CN43","BCR8连接异常",574,2),
            new ErrorBitInfo("CN44","RM1连接异常",574,3),
            new ErrorBitInfo("CN45","RM2连接异常",574,4),

            #endregion

            #region [安全门异常]

            new ErrorBitInfo("CJMIFB00L1SDL03","安全门SDL03打开",96,2),
            new ErrorBitInfo("CJMIFC00L1SDL04","安全门SDL04打开",96,3),
            new ErrorBitInfo("CJMIFB00L2SDL05","安全门SDL05打开",96,4),
            new ErrorBitInfo("CJMIFC00L2SDL06","安全门SDL06打开",96,5),
            new ErrorBitInfo("CJRGV200SDL07","安全门SDL07打开",96,6),
            new ErrorBitInfo("CJVCV400SDL08","安全门SDL08打开",96,7),
            new ErrorBitInfo("CJMIF900SDL09","安全门SDL09打开",97,0),
            new ErrorBitInfo("CJMIF800SDL10","安全门SDL10打开",96,1),
            new ErrorBitInfo("CJMIF700SDL11","安全门SDL11打开",97,2),
            new ErrorBitInfo("CJMIF600SDL12","安全门SDL12打开",97,3),
            new ErrorBitInfo("CJMCV500SDL13","安全门SDL13打开",97,4),
            new ErrorBitInfo("CJMIF400SDL14","安全门SDL14打开",97,5),
            new ErrorBitInfo("CJMIF300SDL15","安全门SDL15打开",97,6),
            new ErrorBitInfo("CJMIF100SDL16","安全门SDL16打开",97,7),
            new ErrorBitInfo("CJMIF100SDL17","安全门SDL17打开",98,0),
            new ErrorBitInfo("CJRGV100SDL18","安全门SDL18打开",98,1),
            new ErrorBitInfo("CJVCV300SDL19","安全门SDL19打开",98,2),
            new ErrorBitInfo("CJVCV700SDL21","安全门SDL21打开",98,4),
            new ErrorBitInfo("CJVCV800SDL23","安全门SDL23打开",98,6),
            new ErrorBitInfo("CJRGV100SDL24","安全门SDL24打开",98,7),
            new ErrorBitInfo("CJMIFA00SDL25","安全门SDL25打开",99,0),

            // 火警异常
            new ErrorBitInfo("FIRE_ALARM","火警异常",99,1),

            #endregion

            #region [烟感异常]

            // 2024-01-08 ADD
            new ErrorBitInfo("MCC01-TEMP","MCC01电柜内温度过高", 585, 4),
            new ErrorBitInfo("MCC01-SMOKE","MCC01电柜内烟感报警器触发", 585, 5),
            new ErrorBitInfo("MCC02-TEMP","MCC02电柜内温度过高", 585, 6),
            new ErrorBitInfo("MCC02-SMOKE","MCC02电柜内烟感报警器触发", 585, 7),
            new ErrorBitInfo("MCC03-TEMP","MCC03电柜内温度过高", 584, 0),
            new ErrorBitInfo("MCC03-SMOKE","MCC03电柜内烟感报警器触发", 584, 1),

	        #endregion
        };
    }
}














